+ 1

What is with() in python

30th Jul 2019, 9:15 AM
SUNDARAMAN IYER
SUNDARAMAN IYER - avatar
10 Answers
+ 2
Not sure I fully understand the question, but here goes. () is typically placed after a function to enable the function to act upon the data within the (). Example: x = input() will prompt the user to enter information which may be displayed by print(x) Another example def code_function(): write your code here: create a function result Print(code_function(data)) The () contain the data you wish the function to act on. Sololearn modules cover this in detail. Take your time with it
30th Jul 2019, 9:43 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 3
SUNDARAMAN IYER I think we may be looking at a little language barrier here. Has swim answered your question with his post? If not, can you phrase your question differently? Are you trying to understand the use of functions within Python, or how () associates with functions, or something else? Don't give up, cause we won't. 😁
30th Jul 2019, 10:46 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 1
I agree with you , My question was what is with function use in python
30th Jul 2019, 9:45 AM
SUNDARAMAN IYER
SUNDARAMAN IYER - avatar
+ 1
+1 I too would like to understand your question and help out :)
30th Jul 2019, 11:39 AM
Brave Tea
Brave Tea - avatar
+ 1
apparantly it is some sort of try finally block replacement
30th Jul 2019, 5:49 PM
Brave Tea
Brave Tea - avatar
0
Actually I was working with project and a syntax filename = input("Enter a filename: ") with open(filename) as f: text = f.read() print(count_char(text, "r"))
30th Jul 2019, 5:43 PM
SUNDARAMAN IYER
SUNDARAMAN IYER - avatar
0
So can anyone figure it out
30th Jul 2019, 5:44 PM
SUNDARAMAN IYER
SUNDARAMAN IYER - avatar