Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: r+ mode in files
Post: RE: r+ mode in files

(Feb-14-2023, 09:03 PM)deanhystad Wrote: I understand your confusion. r+ is confusing. When you write, were do you write? The logical answer is that writing starts at the file pointer. When you ...
grkiran2011 General Coding Help 5 1,619 Feb-15-2023, 11:56 PM
    Thread: r+ mode in files
Post: RE: r+ mode in files

(Feb-14-2023, 03:24 PM)rob101 Wrote: There are six access modes (that I know of): 1. 'r' Read only: the default 2. 'w' Write: Create a new file or overwrite the contents of an existing file. 3. '...
grkiran2011 General Coding Help 5 1,619 Feb-15-2023, 11:54 PM
    Thread: r+ mode in files
Post: r+ mode in files

Hi Viewer, I know r+ mode is used for reading and writing to a file. What I find strange is as soon as I open the file and then write to the file instead of reading, it writes from the first positio...
grkiran2011 General Coding Help 5 1,619 Feb-14-2023, 02:03 PM
    Thread: superclass and super()
Post: superclass and super()

Hi Viewer, I have two questions related to inheritance: 1. Let's say I have a class A and another class B which is inheriting A. So B is the subclass of A. When instantiating the class B does the s...
grkiran2011 General Coding Help 1 1,751 Jun-19-2020, 11:55 PM
    Thread: REPL
Post: REPL

Hi, The Python REPL is it an interpreter or a compiler? When I have a file, let's say test.py and when I type, python test.py at the command prompt, the file get's compiled into byte code and then ...
grkiran2011 General Coding Help 1 2,123 Jan-08-2020, 08:34 AM
    Thread: Exception Handling
Post: Exception Handling

Hi, There are two constructs that Python offers on exceptions. One is try-except-finally and the other is try-finally. I am trying to understand in which situations do we use try-finally? Since us...
grkiran2011 General Coding Help 3 2,988 Oct-05-2018, 01:54 PM
    Thread: Function Default Arguments
Post: RE: Function Default Arguments

Thanks for taking time to respond.
grkiran2011 General Coding Help 7 3,756 Aug-09-2018, 11:12 AM
    Thread: Function Default Arguments
Post: RE: Function Default Arguments

Thanks Buran I understand the difference between is and == in python. My question was more like even though tuples and integers are immutable types, for integers python decides to use the same object...
grkiran2011 General Coding Help 7 3,756 Aug-09-2018, 10:39 AM
    Thread: Split not working
Post: RE: Split not working

Hi, Try the following: import sys contenuTiers = '78717;26410009000010;0;0;1' sys.stderr.write(contenuTiers.split(';')[0])
grkiran2011 General Coding Help 3 3,124 Aug-09-2018, 09:32 AM
    Thread: Function Default Arguments
Post: RE: Function Default Arguments

Hi, I tried them seperately. And even now cross checked it. I am getting "not matched" in the second case.
grkiran2011 General Coding Help 7 3,756 Aug-09-2018, 09:27 AM
    Thread: Function Default Arguments
Post: Function Default Arguments

Hi Viewer, Got a query on function default arguments. i = 10 def fun(l = 10): if i is l: print('mathced') else: print('not matched') fun()The above code would output "match...
grkiran2011 General Coding Help 7 3,756 Aug-09-2018, 09:09 AM
    Thread: Packages and Modules
Post: Packages and Modules

Hi Viewer, import my_lib import my_lib.my_soundWhen I checked locals() listing, I do not see any difference. How does python know that I have imported a sub-package under my_lib. Thanks, Kiran.
grkiran2011 General Coding Help 1 2,487 Mar-01-2018, 12:30 PM
    Thread: Function parameters
Post: Function parameters

Hi Viewer, While defining function parameters we should pass the dynamic keyword argument (**kwargs) at the end. Otherwise python throws a syntaxerror. Is it just that the syntax has been defined as ...
grkiran2011 General Coding Help 2 2,724 Feb-10-2018, 12:07 PM
    Thread: Reversing a String
Post: Reversing a String

Hi Viewer, Just started learning to code in Python. Was going thru some code online on reversing a string. The code is as follows: s = "Hello" print(s[::-1]) Could not understand the underlying lo...
grkiran2011 Homework 1 2,356 Dec-02-2017, 03:10 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020