Variables of the Python tuple type and variables of type string are passed as parameters

Source: Internet
Author: User

When I do the selenium element object stripping today (I put the element object into a variable of the tuple type, format: User = ("id", "x-auto-2")), encounter a tuple variable, and the STR string variable as a parameter to pass the value of the problem, found that the output of the string is the first value in the tuple, the study of the majority of days, and finally figured out.

1, in the function of the parameter, the variable types are sequential, such as: def name (X,x,*lo,**loo), Integer, string and other types must be placed in the tuple (* number Beginning) and dictionary (* * two asterisks) before

2, such as: def name (Self,x,x,*lo,**loo), the argument when self must be removed, otherwise the printed data will be confused.

See, the above self is also passed the parameter, and the value in the *locator tuple is divided and assigned. This is not the result I want, unless you assign self to it, or remove self.

1Locator = ("ID","x-auto-2")2user ="system"3Self =None4 Print(Locator)5 Print(Type (locator))6 7 defGroup (self,user_text,*locator):8     Print("Self ------%s"%Self )9     Print("user_text------%s"%user_text)Ten     Print(Locator) One  AGroup (Self,user,*locator)

I made my own. The framework has implemented log, read Config.ini parameters, and implemented object library, element library (element into the tuple variable to manage), case library separation. Years later, the implementation reads data from Excel, receives mail, integrates test reports, and so on.

Variables of the Python tuple type and variables of type string are passed as parameters

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.