+ 3
Does anyone here knows what the 're' and 'os' libraries are, and what are they used for?
2 Respostas
+ 5
re Module
========
re module is for regular expression or simply say that it is used for searching, matching, finding parts of a string from whole junk. An example maybe like you have a string which contains all the names of cars, but you want only the names of cars who's name starts with 'A',there comes re module.
os Module
=========
os module is used for interactions with the operating system itself. Something like checking the current directory, executing system commands and much more.
+ 1
HI, In computing, a regular expression, also referred to as “regex” or “regexp”, provides a concise and flexible means for matching strings of text, such as particular characters, words, or patterns of characters. A regular expression is written in a formal language that can be interpreted by a regular expression processor.
In short: Really clever “wild card” expressions for matching and parsing strings
You can read more in detail with many examples here: http://www.tutorialspoint.com/JUMP_LINK__&&__python__&&__JUMP_LINK/python_reg_expressions.htm
____________________________________________________________
The OS module in Python provides a way of using operating system dependent
functionality.
The functions that the OS module provides allows you to interface with the
underlying operating system that Python is running on – be that Windows, Mac or
Linux. You can find important information about your location or about the process.
You can read more in detail here: https://www.tutorialspoint.com/python/os_file_methods.htm