<< < 1 2 3 4 5 6 > >>   Sort: Rank

What Is Python Module 'sys'
What Is Python module "sys"? "sys" is a Python internal module that provides access to some variables used or maintained by the interpreter and to functions that interact strongly with the interpreter. Here are some important properties and functions provided by the "sys" module: &gt;&gt;&am...
2018-11-11, 1951🔥, 0💬

sys.argv - Command Line Argument List
How to retrieve command line arguments with sys.argv list? If execute a Python script file with the "python" command, you can use the sys.argv list to retrieve command line arguments. Note that the first argument, sys.argv[0], represents the Python script file name. Here is a Python script file exam...
2018-11-11, 1847🔥, 0💬

're' Module - Regular Expression Operations
Where to find tutorials on Python "re" Module? Here is a list of tutorials to answer many frequently asked questions compiled by FYIcenter.com team on Python "re" Module. What Is Python Module 're' re.search() - Search for First Match re.findall() - Find All Matches re.match() - Match from String Be...
2018-11-11, 1520🔥, 0💬

Printing Python Engine Information
How to print out Python engine information? Here is a Python example on how to print out Python engine information: &gt;&gt;&gt; import sys &gt;&gt;&gt; sys.getwindowsversion() sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1') &...
2018-11-11, 1483🔥, 0💬

'sys' Module - System Parameters and Functions
Where to find tutorials on Python "sys" Module? Here is a list of tutorials to answer many frequently asked questions compiled by FYIcenter.com team on Python "sys" Module. What Is Python Module 'sys' Printing Python Engine Information sys.argv - Command Line Argument List   ⇒ What Is Python Module ...
2018-11-11, 1226🔥, 0💬

re.search() - Search for First Match
How to search for the first match of a regular expression using re.search()? The re.search() function allows you to search for the first match of a given regular expression in a target string. import re m = re.search(pattern, string, flags=0) Where: pattern is the regular expression string is the ta...
2018-10-19, 2999🔥, 0💬

re.findall() - Find All Matches
How to find all matches of a regular expression using re.findall()? The re.findall() function allows you to find all matches of a given regular expression in a target string. import re l = re.findall(pattern, string, flags=0) Where: pattern is the regular expression string is the target string l is ...
2018-10-19, 1912🔥, 0💬

re.sub() - Substitute Matches with String
How to substitutes matches of a regular expression in a target string with another string using re.sub()? The re.sub() function allows you to substitute (or replace) matches of a given regular expression in match the beginning part of a target string with of a given regular expression. import re f =...
2018-10-19, 1698🔥, 0💬

re.match() - Match from String Beginning
How to match the beginning part of a target string with a regular expression using re.match()? The re.match() function allows you to match the beginning part of a target string with of a given regular expression. import re m = re.match(pattern, string, flags=0) Where: pattern is the regular expressi...
2018-10-19, 1620🔥, 0💬

What Is Python Module 're'
What Is Python module "re"? "re" is a Python internal module that provides regular expression matching and replacement operations similar to those found in Perl. Here are some important properties and functions provided by the "re" module: &gt;&gt;&gt; import re &gt;&gt;&gt; ...
2018-10-19, 1344🔥, 0💬

json.dumps() - Dumping Object into JSON
How to dump (or encode, serialize) a Python object into a JSON string using json.dumps()? The json.dumps() function allows you to dump (or encode, serialize) Python objects into JSON strings: json.dumps(obj, *, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=...
2018-10-13, 3144🔥, 0💬

Use Match Group \g&lt;n&gt; in Replacement
How to how to use matched string and groups in replacements with re.sub()? When calling the re.sub() function, you can use matched string and groups in replacements with the following escape sequences: \g&lt;0&gt; # represents the matched string \g&lt;1&gt; # represents the first gro...
2018-10-13, 2292🔥, 0💬

re.split() - Splits with Regular Expression
How to split a given string with a regular expression as the delimiter using re.split()? The re.split() function allows you to split a given target string using matches of a given regular expression as the delimiter. import re l = re.split(pattern, string, maxsplit=0, flags=0) Where: pattern is the ...
2018-10-13, 1788🔥, 0💬

'json' Module - JSON Encoder and Decoder
Where to find tutorials on Python "json" Module? Here is a list of tutorials to answer many frequently asked questions compiled by FYIcenter.com team on Python "json" Module. What Is Python Module 'json' json.dumps() - Dumping Object into JSON Generating JSON Strings in Pretty Format Dumping JSON Ou...
2018-10-13, 1375🔥, 0💬

What Is Python Module 'json'
What Is Python module "json"? "json" is a Python internal module that allows to encode and code JSON strings. Here are some important properties and functions provided by the "json" module: &gt;&gt;&gt; import json &gt;&gt;&gt; json.dumps() # serializes a given object into a ...
2018-10-13, 1182🔥, 0💬

Extending json.JSONEncoder Class
How to extend json.JSONEncoder class? I want to encode other Python data types to JSON. If you encode your own data types to JSON strings, you need to extend the json.JSONEncoder class and override the default() function. The following Python example shows you how to extend json.JSONEncoder class to...
2018-10-08, 3994🔥, 0💬

json.loads() - Loading JSON into Object
How to load (or decode, deserialize) a JSON string into a Python object using json.loads()? The json.loads() function allows you to load (or decode, deserialize) JSON strings (str, bytes or bytearray types) into Pythong objects: json.loads(s, *, encoding=None, cls=None, object_hook=None, parse_float...
2018-10-08, 2543🔥, 0💬

What Is json.JSONEncoder Class
What Is json.JSONEncoder Class? json.JSONEncoder class is the underlying class that supports json.dumps() functions. The following Python example shows you how to use json.JSONEncoder class to perform the same JSON encoding job as json.dumps function: &gt;&gt;&gt; import json &gt;&am...
2018-10-08, 2052🔥, 0💬

Dumping JSON Output to File
How to dump (or encode, serialize) a Python object into file or an output stream as a JSON string using json.dump()? json.dump(o,fp,...) function performs the same job as json.dumps(o,...) except that it directs the JSON string to the output stream of a given file pointer. Here is a Python example t...
2018-10-08, 1391🔥, 0💬

Generating JSON Strings in Pretty Format
How to generate JSON strings in pretty format using json.dumps()? You can control the JSON output string format with "indent", "separators" and "sort_keys" arguments of the json.dumps() function: Here is a Python example that generates a pretty formatted JSON string with property keys sorted: &g...
2018-10-08, 1335🔥, 0💬

http.client.HTTPResponse Objects
What properties and functions are supported on http.client.HTTPResponse objects? If you get an http.client.HTTPResponse object from a urlopen() function call, you should be able use the following properties and functions: &gt;&gt;&gt; r = urllib.request.urlopen('http:/ /httpbin.org/get')...
2018-09-24, 10869🔥, 0💬

json.tool - JSON Pretty-Print Tool
What is json.tool? Can I use it to convert a JSON string a pretty-print format? json.tool is a special internal executable module - a module with main() so you can run it as Python script. When you run json.tool, (or json.module.main()), it will read a JSON string from the stand input and write the ...
2018-09-24, 2361🔥, 0💬

Sending an HTTP Request with 'urllib.request'
How to send an HTTP request using the "urllib.request" module? To send an HTTP request to the Internet, you can use the urllib.request.urlopen() function as described below: r = urllib.request.urlopen(url, data=None, [timeout, ]*, cafile=None, capath=None, cadefault=False, context=None) where: url c...
2018-09-24, 1862🔥, 0💬

What Is Python Module 'urllib'
What Is Python module "urllib"? "urllib" is a Python internal module that allows you to communicate with Internet resources that are represented by URLs. Two main Internet protocols are supported: HTTP and FTP. The current version of "urllib" module is divided into 4 sub-modules: urllib.request - fo...
2018-09-24, 1642🔥, 0💬

<< < 1 2 3 4 5 6 > >>   Sort: Rank