Example of how to use the sets module in python: pythonsets
The examples in this article briefly describe how to use the sets module in python and share it with you for your reference.
The specific method is as follows:
Import sets magic_chars = sets. Set ('Abracadabra ') print magic_chars poping_chars = sets. Set ('others') print poping_chars print "". join (magic_chars & poping_chars)
The program running result is as follows:
Set (['A', 'R', 'B', 'C', 'D']) Set (['A', 'C', 'E ', 'D', 'G', 'F', 'I', 'l', 'O', 'P', 's', 'R', 'U ', 'T', 'x']) acrd
I hope this article will help you with Python programming.
What is the concept of a module in python? Can I use a simple example?
A module is a file, and the imported file is imported into the corresponding module. You can use the classes, functions, variables, and other information defined in the module. If there are many modules, you can use packages to manage them. You can put the files into a folder and add a _ init _. py file.
How to use functions in the Python Module
1. Know what function (func) you want, in that module, and then import xxx
2. help (xxx. func)