Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Examples of Python any parameters     - Java interview questions in nine radio (Programming)

- To install the latest version of the EPEL on CentOS 5.x or 6.x (Linux)

- Root of AVL Tree- achieve balanced search trees AVL tree (Programming)

- Safety testing Unix and Linux server entry succinctly (Linux)

- Merge Sort (Programming)

- VirtualBox - Linux system virtual machine shared folders (Linux)

- Generated characters using Java Videos (Programming)

- Use value type build better applications Swift (Programming)

- MySQL Tutorial: Philosophical Reflections on the unauthenticated user (Database)

- Unix system security configuration (Linux)

- Android custom title bar (Programming)

- Use Ambari rapid deployment Hadoop big data environment (Server)

- Linux Proc File System Experiment (Linux)

- gzip, bzip2, xz, tar, zip compression, archive Detailed (Linux)

- DupeGuru- find and remove duplicate files (Linux)

- Linux / BSD firewall M0n0wall Profile (Linux)

- CentOS 6.4 dial-up Raiders (Linux)

- IntelliJ IDEA common list of shortcuts (Linux)

- Doubly linked list basic operations (Linux)

- MySQL query plan key_len know all (Database)

 
         
  Examples of Python any parameters
     
  Add Date : 2018-11-21      
         
         
         
  Collection parameters:

In the function definition, the collection of location parameters do not match the tuple.

>>> Def f (* args): print (args)

...

When this function is called, python relevant parameters for all positions collected into a new Ganso, and the assignment of this tuple to the variable args. (Can be indexed or stepping in for loop)

>>> F ()

()

>>> F (1)

(1,)

>>> F (1, 2, 3, 4)

(1, 2, 3, 4)

** Similar characteristics, but it is only valid for keyword arguments. These keyword arguments passed to the new dictionary.

>>> Def f (** args): print ((args)

...

>>> F ()

{}

>>> F (a = 1, b = 2)

{ 'A': 1, 'b': 2}

Another example:

>>> Def f (a, * pargs, ** kargs): print (a, pargs, kargs)

...

>>> F (1, 2, 3, x = 1, y = 2)

1 (2, 3) { 'y': 2, 'x': 1}

Unpack parameters

When you call the * syntax unpack parameter set.

>>> Def func (a, b, c, d): print (a, b, c, d)

...

>>> Args = (1, 2)

>>> Args + = (3, 4)

>>> Func (* args)

1234

Similarly, ** will be key-value pairs unpack a dictionary.

>>> Args = { 'a': 1, 'b': 2, 'c': 3}

>>> Args [ 'd'] = 4

>>> Func (** args)

1234

to sum up

* / ** Syntax: in the head, it means that any number of parameters were collected, and the call is unpack it any number of arguments.
     
         
         
         
  More:      
 
- Modify Linux SSH default port 22 in several ways (Linux)
- PHP Performance Analysis and Experiment: Performance Micro Analysis (Programming)
- Linux keyboard recording script (Linux)
- DupeGuru- find and remove duplicate files (Linux)
- VMware6 achieve nat Internet (Linux)
- Java inheritance initialization problem (Programming)
- MariaDB 10.0.X, the dynamic column support JSON format to obtain data (Database)
- Java Foundation - Variables and data types (Programming)
- Linux system security check method (Linux)
- Java string intern constant pool resolution Introduction (Programming)
- These days have been tossing in the Linux under the ASP.NET 5, on the next in the other operating systems in the ASP.NET 5 or. NET applications, in order to complete the MS VM (CoreCLR) run is not far Reach, the effect of the application.

Cur
(Server)
- Linux development management utility command (Linux)
- Linux and Windows virtual machine shared folders ---- Linux install VMware tools (Linux)
- Oracle table Access Control (Database)
- How nodeclub constructed Docker image (Server)
- Oracle 11g RMAN cross-platform transfer table space (Database)
- Linux SU command security Suggestions (Linux)
- MySQL related statements (CRUD) (SQLyog software) (Database)
- ntop monitoring software configuration and installation (Linux)
- Linux Getting Started Tutorial: How to set up a static MAC address on VMware ESXi virtual machine (Mobile)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.