#!/user/bin/python3#files: using_sys.pyf = open ("Filename.txt", "r+")num = F.read ()F.close ()Lstnum = Num.split (' \ t ')A, b = Int (lstnum[0]), float (lstnum[1])Print (Type (a), type (b))Print (A, B)RET = A * * bPrint (ret)Reads cardinality A and
The contents of this chapter:
List & Tuple actions
String manipulation
Dictionary operations
Collection operations
File operations
Character encoding and transcoding
The Python language has never been so
"Question"In some Python programs the first line is often able to see the following two lines of sentence"" #!/usr/bin/python"" #!/usr/bin/env python"For what???"ReasonThe first line of the scripting language is to point out that you want the code
Examine the @log adorners in the previous section:def log (f): def fn (x): Print ' ' + F.__name__'() ... ' return f (x) return fnIt is found that for decorated functions, the log-printed statement is immutable (except for the
PythonAfter setting up a python development environment, how do I view the API documentation? It's actually very simple:
First open the command line and enter in the DOS window:
Python-m pydoc-p 4895
Python-m Pydoc--Open the Pydoc
Argparse is a standard module used by Python to parse command-line arguments and options in place of obsolete optparse modules. The role of the Argparse module is used to parse command-line arguments.The most basic, starting from one of the simplest
"Preparation"In the Python source program used to specify that the source program to use that executable program to run it"For example:#!/bin/sh Shell Script#!/usr/bin/perl perl Script#!/usr/bin/python python Script#!/usr/bin/python3 Python3 Script#!
Investigate Student class:class Student (object): def __init__ (self, Name, score): = name = ScoreWhen we want to modify the Scroe property of a Student, we can write this:s = Student ('Bob',60But it can also be written like
Description: Usually often encounter time conversion, one after another to hit the format of the characters, and query some, collation as follows.
Format Code table:
%a: Shorthand for the day of the week. (Mon-Sun)%A: The day of the week is
Studied for several hours, presumably for a special method in Python, smattering, now writes about his own understanding, and records some of the resources found. When you have more in-depth understanding of the time, then to
JS Regular expression front-end page template to apply the Django FoundationJS Regular expression:1. Define Regular expressions
/.../for defining regular expressions
/.../g represents a global match
/.../i indicates case insensitive
English documents:The constructor builds a tuple whose items is the same and in the same order as iterable' s items. iterable May is either a sequence, a container that supports iteration, or an iterator object. If iterable is already a tuple, it is
1.python stringPython has no characters, all of them are called strings and are represented by single quotes.Similarity of strings, lists, Ganso in 2.python(1) Access, all using str[i] to access the first i+1 elements.(2) Slice, str[i:j] to
Module import and common built-in methods__file__: Os.path.dirname (__file__) and Os.path.join (dirname, filename) can add modules to the Python environment variable directory by Sys.path.append ()__NAME__: __name__ returns "__main__" when the py
A recursive function is a function that calls itself directly or indirectly for loopingdef mySum (L): If not L:return 0 else:return l[0]+mysum (l[1:]) print mySum ([1,2,3,4,5])This function computes the and of all the elements of the list in a
What is the pass statement in Python? Indicates that it does nothing and is generally used as a placeholder statement. Pass statement the specific role and use of the method, we look down.The function of PASS statements in functionsWhen you are
BeautifulSoup (1), beautifulsoup
Import reFrom bs4 import BeautifulSoupDoc = [' Page title ',' This is paragraph one .',' This is paragraph two .','']Soup = BeautifulSoup (''. join (doc ))Print (soup. prettasks ())Titleappssoup.html. head.
Argparse and pythonargparse in python
Argparse is a standard module used by python to parse command line parameters and options. It is used to replace outdated optparse modules. The argparse module is used to parse command line parameters.
The
Difference between continue break and continuebreak
There are two loop methods in the loop: continue, break
Continue only jumps out of this loop and does not continue or start the next loop.
The break will jump out of the entire loop, which will be
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