We know that the colon and indentation in Python represent curly braces, which can save a lot of lines of code, but can be optimized to minimize the level and indentation of loops, making the code look more concise and logically clearer. Not only
We are used to using the TAB key when using Linux commands, and we can implement similar functions in Python. The specific code is as follows:
$ cat startup.py#!/usr/bin/python# Python startup fileImport SysImport ReadLineImport RlcompleterImport
If statements are used to verify a condition, and if the condition is true, we run a statement (called a if-block), otherwise we process another statement (called a else-block). else clauses are optional.
Use the IF statement
If condition
If 1 =
First, we have to look at 3GQQ's related protocols for this, we need a WAP-enabled browser that can use Firefox's Wmlbrowser plugin, After opening FF, access address: https://addons.mozilla.org/zh-cn/firefox/search/?q=wmlbrowser&cat=all &x=17&
#定义变量a
The code is as follows
Copy Code
>>> A = 0>>> Print a
0# definition function P ()
The code is as follows
Copy Code
>>> def p ():... print a...>>> P ()
0# definition
I. Two list difference sets
If you have the following two arrays:A = [1,2,3]b = [2,3]
The desired result is [1]
Here's a record of three implementations:
1. The normal way
The code is as follows
Copy Code
RET = []For
The use of dial-up Internet, there are generally a local IP and an extranet IP, using Python can easily get these two IPUse the gethostbyname and GETHOSTBYNAME_EX two functions to implement
The code is as follows
Copy Code
Windows systems for the brothers who often play Linux, if you encounter a lot of their own business win system to go to operation, if not too familiar or very headache, especially in the face of hundreds of units, the situation is more complex,
Single Dash (_)
In the Interpreter
In the Interpreter, _ represents the result of the execution of the previous article in an interactive interpreter session. This usage is somewhat similar to the use of the previous command in Linux. Just the
I. Demand
The company asked to merge all the handling events from January 1, 16 to the present, simply by merging all the dailies into a single table. Just 16 all the dailies are kept in a folder, where all the logs are aggregated into an Excel
Def list_index (list,sub_ele,index=[],a=0): for i in List: print ' search ... ' + ' Index ' if isinstance (i,list): index.append (a) x=list_index (i,sub_ ele,index,a=0
The code is as follows:1complement = {'A':'T','G':'C','C':'G','T':'A'}2Rev_seq ="'3With open (r'D:\Rosalind\haha.txt','w+') as F1:4With open (r'D:\Rosalind\rosalind_revc.txt','R') as F:5Dna_seq =F.read ()6Dna_seq =list (Dna_seq.strip ())7
Because in the calculation of the running time of an algorithm, you need to read the creation date of the file and the date of modification, and then calculate the difference between the two, after searching the relevant program on the Internet, I
The first step:try to write Hello world programThis is the first program I wrote in python, one small step, One big step in my Life.Create a file under Linux called hello.py,Then execute the command: python hello.py, outputSpecify interpreter (refer
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