linecache.getline() in Python Last Updated : 22 Apr, 2020 Comments Improve Suggest changes Like Article Like Report With the help of linecache.getline() method, we can get a particular line by providing a line number, one of the usecase for this method is to find the syntax error in the given line number within a big file by using linecache.getline() method. Syntax : linecache.getline(filename, lineno) Return : Return the content of given line number. Input File : Example #1 : In this example we can see that by using linecache.getline() method, we are able to get the content of a given line from a big file by using this method. Python3 1=1 # import linecache import linecache as lc # Using linecache.getline() method gfg = lc.getline('File.txt', 1) print(gfg) Output : Example #2 : Python3 1=1 # import linecache import linecache as lc # Using linecache.getline() method gfg = lc.getline('File.txt', 2) print(gfg) Output : Comment More infoAdvertise with us Next Article linecache.getline() in Python J Jitender_1998 Follow Improve Article Tags : Python Python-linecache Practice Tags : python Similar Reads fileinput.lineno() in Python With the help of fileinput.lineno() method, we can get the line number for every line on line read from input file by using fileinput.lineno() method. Syntax : fileinput.lineno() Return : Return the line number. Example #1 : In this example we can see that by using fileinput.lineno() method, we are 1 min read Wand path_line() function in Python path_line() is a function specially introduced for paths. path_line() draws a line from a destination point to the point we want the line we end to. It takes only end point as argument. Syntax : wand.drawing.path_line(to, relative) Parameters: ParameterInput TypeDescriptiontosequence or (numbers.Rea 1 min read Wand line() function in Python line() is another drawing function present in wand.drawing module. As the name implies line() function is used to draw a line in the image. line() function only need two arguments that are start and end point of the line that we want to draw. Syntax : wand.drawing.line(start, end) Parameters : Param 2 min read fileinput.isfirstline() in Python With the help of fileinput.isfirstline() method, we can get the boolean value as True if line read from the file is very first line else false by using fileinput.isfirstline() method. Syntax : fileinput.isfirstline() Return : Return True if line read is first line of that file. Example #1 : In this 1 min read Multiline Comments in Python A multiline comment in Python is a comment that spans multiple lines, used to provide detailed explanations, disable large sections of code, or improve code readability. Python does not have a dedicated syntax for multiline comments, but developers typically use one of the following approaches:It he 4 min read Python: Inplace Editing using FileInput Python3's fileinput provides many useful features that can be used to do many things without lots of code. It comes handy in many places but in this article, we'll use the fileinput to do in-place editing in a text file. Basically we'll be changing the text in a text file without creating any other 2 min read Wand polyline() function in Python polyline() is another drawing function present in wand.drawing module of Wand. polyline() is similar to polygon() function the only difference is that, it will not close the stroke line b/w first and last point. Similar to polygon() it also takes a list of point tuples as an argument. Syntax : wand. 1 min read File Objects in Python A file object allows us to use, access and manipulate all the user accessible files. One can read and write any such files. When a file operation fails for an I/O-related reason, the exception IOError is raised. This includes situations where the operation is not defined for some reason, like seek() 6 min read fileinput.filelineno() in Python With the help of fileinput.filelineno() method, we can get the line number for every line on line read for every file from input file by using fileinput.filelineno() method. Syntax : fileinput.filelineno() Return : Return the line number for every file. Example #1 : In this example we can see that b 1 min read Read a file line by line in Python Python provides built-in functions for creating, writing, and reading files. Two types of files can be handled in Python, normal text files and binary files (written in binary language, 0s, and 1s). In this article, we are going to study reading line by line from a file.Example:Pythonwith open('file 4 min read Like