Does anyone here knows what the 're' and 'os' libraries are, and what are they used for? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Does anyone here knows what the 're' and 'os' libraries are, and what are they used for?

8th Mar 2016, 7:06 AM
Mayur Deshmukh
Mayur Deshmukh - avatar
2 Answers
+ 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.
10th Mar 2016, 4:21 AM
root
root - avatar
+ 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
5th Oct 2016, 4:25 PM
Krasimir Vatchinsky
Krasimir Vatchinsky - avatar