1 __module__ Description__MODULE__:Prints __main__ If the current module is executed for the top-level moduleIf the current module is the calling module, the name of the current module is printed2 __module__ Exampledef Fun (): Pass Print (fun.) _
Interview with a very boring problem ~ ~ ~Requirement: Reverse the string in as many ways as possible in a python environment, e.g. invert s = "abcdef" to "FEDCBA"First: Use string slices= s[::-1]The second type: The reverse method of using the list=
Basic operationsf = open("file1", "r") # 打开文件first_line = f.readline() # 读一行data = f.read() # 读取剩下所有内容,文件大时候不要用f.close() #关闭文件If we want to loop the file and output the split on line nineth:for index, line in
InstallationDjango is a Python-language environment, so make sure you have Python installed on your computer first.LinuxUbuntu:sudo pip install django==1.11.7A version is specified in the installation, you can modify the version number, or you do
Formatted outputTo understand formatted output, you first understand the placeholder% placeholder S string D-digitReplace the placeholder placeholder with the first one in order name = input ( " Enter your name: " ) Age = input ( "" Span style= "
When we use the Sys.path.append (args) directive to import a module into a program, the append operation is only done in memory, and if you want to permanently add it, you need to modify the environment variable.We found that when we used print (Sys.
Python road, Day1-python base 1 variablesVariables are used to store information that is referenced and manipulated in a computer program. They also provide a way to tag data with descriptive names so that our programs can be more clearly understood
1) Simple application of ZipFileIf you are simply using Python for compression and decompression, the method is as followsImportZipfilef= ZipFile. ZipFile ('Filename.zip','W', ZipFile. zip_deflated) F.write ('1.txt') F.write ('2.doc') F.write
The list generation, which is the comprehensions, is a very simple and powerful build of Python built-in that can be used to create lists. Using a list-generated formula, you can write very concise code.1 >>> list (range (0))2 [0, 1, 2, 3, 4, 5, 6, 7
1. Python opens the HTTP serverPython-m simplehttpserver 8080If you are prompted with an error:Python.exe:No module named SimplehttpserverThen try the command:Python-m Http.server2. Execute the PY script file to open the CGI mapPython-m Http.server--
---restore content starts---One, ASCII code There are times when you cannot enter Chinese in Python2, because the Python2 interpreter uses the ACII code when loading the. py file, and has been more utf-8 in Python3.The ASSCII code is a 8-bit byte,
Python is interpreted (with good platform compatibility, can be run in any environment, modified code can be modified directly, can be quickly deployed, without downtime maintenance), dynamic (Python does not need to set a variety of variables prior
First, Ajax introduction Ajax(asynchronous JavaScript and XML) is translated into Chinese as " asynchronous JavaScript and xml." Even if you interact asynchronously with the server in Javascript, the data transferred is XML(of course, the data
Reference URL:http://blog.csdn.net/mach_learn/article/details/41744487Beginner's TutorialThank you ~Automatically identify the verification code, will be some of the interference factors are also identified, there are some special symbols, so the
ObjectiveRecently in a function with Django, mainly for the realization of machine monitoring, the process, involving the URL to identify IP routing problems, the beginning with a variety of expressions can not be properly routed to the IP,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service