Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: Reading a file
Post: Reading a file
I have got a simple file read code and I need to understand why it works the way it does.
def ReadFileContents(file_path):
try:
with open(file_path,'r', newline='') as f:
cont... |
|
JonWayn |
General Coding Help |
3 |
1,093 |
Dec-30-2022, 08:35 AM |
|
|
Thread: declaring object parameters with type
Post: RE: declaring object parameters with type
(Dec-13-2022, 07:45 PM)deanhystad Wrote: You can use type annotations
def other_function(brw: Browser):
x = brw <auto complete now knows to look at Browser>This will also help when when ca... |
|
JonWayn |
General Coding Help |
2 |
889 |
Dec-13-2022, 07:46 PM |
|
|
Thread: declaring object parameters with type
Post: declaring object parameters with type
When I pass an object in as a parameter to a function, is there a way to specify in the function declaration what type the parameter is so that I can see its properties as I type. I have a class calle... |
|
JonWayn |
General Coding Help |
2 |
889 |
Dec-13-2022, 07:28 PM |
|
|
Thread: Getting NameError for a function that is defined
Post: RE: Getting NameError for a function that is defin...
(Dec-11-2022, 06:25 AM)deanhystad Wrote: There is no function named getby. class Browser has a method named getby. You can call this method using Browser.getby(browser_instance, locator_type), or ... |
|
JonWayn |
General Coding Help |
2 |
1,092 |
Dec-11-2022, 01:53 PM |
|
|
Thread: Getting NameError for a function that is defined
Post: Getting NameError for a function that is defined
So far, it's a simple class, but I can't understand why I get a NameError for a function that exists in the class. The function is declared on line 15, 'getby', then called on line 25. My code editor ... |
|
JonWayn |
General Coding Help |
2 |
1,092 |
Dec-11-2022, 04:09 AM |
|
|
Thread: Inconsistent loop iteration behavior
Post: RE: Inconsistent loop iteration behavior
(Dec-10-2022, 03:52 AM)Larz60+ Wrote: you should consider breaking your code into functions, code is very difficult to follow as is.
Ok. Thank you for that advice |
|
JonWayn |
General Coding Help |
2 |
992 |
Dec-10-2022, 06:49 AM |
|
|
Thread: Inconsistent loop iteration behavior
Post: Inconsistent loop iteration behavior
I have some code that opens a website, submits search criteria, and loops through each resulting table row for the link to the details behind it. The results may be broken into pages so it keeps track... |
|
JonWayn |
General Coding Help |
2 |
992 |
Dec-09-2022, 11:13 PM |
|
|
Thread: Clarity on global variables
Post: RE: Clarity on global variables
Thank you very much for that clear and thorough explanation |
|
JonWayn |
General Coding Help |
2 |
943 |
Nov-26-2022, 12:10 PM |
|
|
Thread: Clarity on global variables
Post: Clarity on global variables
I have some code in which I have global variables which are accessed within functions but only in some cases they are recognized. I read online that this can be overcome by adding the line global <... |
|
JonWayn |
General Coding Help |
2 |
943 |
Nov-25-2022, 10:44 AM |
|
|
Thread: I need some clarity on the use of the open command
Post: RE: I need some clarity on the use of the open com...
(Nov-07-2022, 08:51 PM)deanhystad Wrote: I think it is a logic error. I can think of no reason why you would open a file and write contents only to have them overwritten. Some sort of default file... |
|
JonWayn |
General Coding Help |
11 |
2,381 |
Nov-08-2022, 11:46 PM |
|
|
Thread: I need some clarity on the use of the open command
Post: RE: I need some clarity on the use of the open com...
(Nov-07-2022, 04:59 AM)deanhystad Wrote: The end result is that anything written to file "f" is overwritten by writes to file "file". This can be show with a small test program.
x = open("junk.txt"... |
|
JonWayn |
General Coding Help |
11 |
2,381 |
Nov-08-2022, 09:53 PM |
|
|
Thread: I need some clarity on the use of the open command
Post: RE: I need some clarity on the use of the open com...
(Nov-07-2022, 01:19 PM)snippsat Wrote: Post whole code if it's more,it will not work as it is now.
If the fullpath exists code will do nothing,if fullpath dos not exists will call function CreateFi... |
|
JonWayn |
General Coding Help |
11 |
2,381 |
Nov-08-2022, 07:28 AM |
|
|
Thread: I need some clarity on the use of the open command
Post: RE: I need some clarity on the use of the open com...
(Nov-07-2022, 04:26 AM)rob101 Wrote: The function is only called if the file (Maryland Case Search.csv) does not exist (the if branch; line 4). In that case, it is created at line 2 of the function ... |
|
JonWayn |
General Coding Help |
11 |
2,381 |
Nov-07-2022, 08:51 AM |
|
|
Thread: I need some clarity on the use of the open command
Post: RE: I need some clarity on the use of the open com...
(Nov-07-2022, 04:59 AM)deanhystad Wrote: The end result is that anything written to file "f" is overwritten by writes to file "file". This can be show with a small test program.
x = open("junk.txt"... |
|
JonWayn |
General Coding Help |
11 |
2,381 |
Nov-07-2022, 08:39 AM |
|
|
Thread: I need some clarity on the use of the open command
Post: I need some clarity on the use of the open command
I am looking at some code someone else wrote in which open is used then again on the same file that is already open. In VB, another language I use, something like this would raise an error and be deni... |
|
JonWayn |
General Coding Help |
11 |
2,381 |
Nov-07-2022, 01:36 AM |
|
|
Thread: managing new windows
Post: managing new windows
I need to control a website at which the links i interact with open in a new popup/tab. The href attribute of the links do me no good because using it in a separate request directs me back to the home... |
|
JonWayn |
General Coding Help |
1 |
1,774 |
Sep-22-2022, 01:29 AM |
|
|
Thread: Can't import csv data
Post: RE: Can't import csv data
(Sep-16-2022, 09:28 PM)rob101 Wrote: (Sep-16-2022, 10:43 AM)JonWayn Wrote: But then when I go to import this file into a Microsoft Access database, nothing is imported.
It's been a number of years... |
|
JonWayn |
General Coding Help |
4 |
1,384 |
Sep-18-2022, 02:07 AM |
|
|
Thread: Can't import csv data
Post: RE: Can't import csv data
(Sep-16-2022, 11:01 AM)buran Wrote: (Sep-16-2022, 10:43 AM)JonWayn Wrote: The csv file gets created ok and looks good as far as I can tell.Then why do you think there is problem with the created f... |
|
JonWayn |
General Coding Help |
4 |
1,384 |
Sep-18-2022, 02:01 AM |
|
|
Thread: Can't import csv data
Post: Can't import csv data
in the code below, page is the webpage response from Playwright for what it's worth:
The csv file gets created ok and looks good as far as I can tell. But then when I go to import this file into a Mic... |
|
JonWayn |
General Coding Help |
4 |
1,384 |
Sep-16-2022, 10:43 AM |
|
|
Thread: Help on ModuleNotFoundError
Post: Help on ModuleNotFoundError
I cant seem to get import commands to work unless I'm working from the same folder as the file I want to import. What is puzzling is that sys.path lists the directory i want to target, in which I have... |
|
JonWayn |
General Coding Help |
0 |
668 |
Sep-11-2022, 03:45 AM |