1 2 3 4 5 6 > >>   Sort: Date

requests.models.Response Objects
What properties and functions are supported on requests.models.Response objects? "requests" module supports the following properties and functions on requests.models.Response objects: >>> r = requests.get() >>> r.status_code >>> r.header...
2022-11-21, 38609🔥, 1💬

💬 2022-11-21 no: no

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: >>> r = urllib.request.urlopen('http:/ /httpbin.org/get')...
2018-09-24, 10760🔥, 0💬

Python Tutorials
Where to find tutorials on Python programming language? I want to learn Python. Here is a large collection of tutorials to answer many frequently asked questions compiled by FYIcenter.com team about Python programming language: Introduction of Python What Is Python Download Latest Version of Python ...
2020-12-22, 6763🔥, 1💬

💬 2020-12-22 kimmy Kervel: Thanks for sharing this precious information with us, this really helpful for me and also for my upcoming project.

Using urllib.parse.urlencode()
How to use urllib.parse.urlencode() function to encode HTTP POST data? My form data has special characters. If your form data has spaces, equal signs, and other special characters, you need to call urllib.parse.urlencode() to encode it before passing it to the urlopen() function. The urlencode() fun...
2018-09-13, 5388🔥, 0💬

Sending FTP Request with urllib.request.urlopen
How to send an FTP request with the urllib.request.urlopen() function? If an FTP server supports anonymous access, you can send an FTP request to retrieve a directory list, or download a file using the urllib.request.urlopen() function: Here is a Python example on how to get a directory list from an...
2023-10-06, 4809🔥, 1💬

💬 2023-10-06 Uriel Adonai JimĂ©nez Leal: Thanks!

Using urllib.request.Request Object
How to use the urllib.request.Request object to build more complex HTTP request? The urllib.request.urlopen() function can take a urllib.request.Request object to let you building more complex HTTP requests. You can use the Request() constructor to build a Request object: q = urllib.request.Request(...
2018-09-13, 4703🔥, 0💬

'*...' and '**...' Wildcard Parameters in Function Definitions
What are "*..." and "**..." Wildcard Parameters in Function Definitions? If you want to define a function that receives a unknown number of parameters, you have to use the "*..." and "**..." Wildcard Parameters in the "def" statement using the following syntax: def func_name(named_parameter,..., *li...
2022-10-26, 4604🔥, 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, 3940🔥, 0💬

'__init__()' Class Method to Initialize New Instance
What is the "__init__()" class method? The "__init__()" class method is a special method that will be automatically called, if you use the class name as a constructor to create a new instance of the class. Here are the rules you need to follow to define and use the "__init__()" class method: 1. Defi...
2018-01-27, 3217🔥, 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, 3115🔥, 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, 2958🔥, 0💬

Create New Instances of a Class
How to Create a New Instance of a Class? There are two ways to create a new instance (object) of a class (or type): 1. The short way: Call the class name as the class constructor function with the following syntax. It will return an instance of the given class. >>> x = class_nam...
2018-01-27, 2522🔥, 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, 2505🔥, 0💬

Python Built-in Primitive Data Types
What Are Python Built-in Primitive Data Types? Python Built-in Primitive Data Types are data types provided by the Python interpreter to represent individual data values. Here is a list of Python Built-in Primitive Data Types: "NoneType" - A special data type represents a single value of nothing, wh...
2023-01-06, 2440🔥, 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, 2333🔥, 0💬

HTTP POST with urllib.request
How to send an HTTP POST request with urllib.request? I want to submit a form to a Website. To submit a form to a Website, you can use the urllib.request.urlopen() function with two arguments: r = urllib.request.urlopen(url, data) where: url can be a URL string or Request object data is request body...
2018-09-13, 2300🔥, 0💬

Use Match Group \g<n> 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<0> # represents the matched string \g<1> # represents the first gro...
2018-10-13, 2268🔥, 0💬

Sending an HTTP POST Request
How to send an HTTP POST request? I want to submit a form to a Website. To submit a form to a Website, you can use the requests.post() function: >>> r = requests.post(url, data = {'key':'value'}) The second argument 'data' is a 'dict' object contains of the list of form field na...
2018-08-14, 2191🔥, 0💬

Installing 'requests' Module
How to install "requests" module? I am getting the "ModuleNotFoundError: No module named 'requests'" error. If you are getting the following error when running "import requests", you need to follow this tutorial to install the "requests" module. C:\fyicenter>python Python 3.6.2 (v3.6.2:5fd33b...
2018-09-01, 2041🔥, 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: >>> import json >&am...
2018-10-08, 2022🔥, 0💬

What Is Wrapper Function
What is a wrapper function in Python? A wrapper function in Python is a function that takes an old function as input parameter and returns a new function. The new function should have the same parameter list and return type. If you call the new function, it will perform the same task as the old func...
2018-02-08, 2006🔥, 0💬

'@...' Function Decorators
What are function decorators in Python? A function decorator is shorthand notation to replace a function with a new version transformed by a wrapper function. A function decorator can be specified using the following syntax: @decorator_wrapper_function def func(): ... Above Python code is actually e...
2018-05-08, 1984🔥, 0💬

urllib.request.Request Properties and Functions
What properties and functions are supported on urllib.request.Request objects? urllib.request.Request objects support the following properties and functions: >>> q = urllib.request.Request(url) host # represents the host name of the url. type # represents the internet protocol t...
2018-09-13, 1978🔥, 0💬

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: >>&am...
2018-11-11, 1923🔥, 0💬

1 2 3 4 5 6 > >>   Sort: Date