Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Login to Corporate Website
Post: RE: Login to Corporate Website

Hi, I already have the code that is working in Powershell. However, I would like to code it Python instead. If I were to write a Python script to login to a website I imagine it would be like this:...
tkj80 General Coding Help 2 2,822 Aug-15-2018, 02:19 AM
    Thread: Login to Corporate Website
Post: Login to Corporate Website

Hi, I'm trying to write a script to login to a corporate website to download reports. I already have the code in PowerShell but I would like to write the same in Python instead. Wonder if someone cou...
tkj80 General Coding Help 2 2,822 Aug-14-2018, 02:04 AM
    Thread: install pdfminer
Post: install pdfminer

Hi, I tried to install pdfminer. I used the following code on cmd: C:\Downloads> python -m pip install pdfminer. However I got the following error: SyntaxError: Missing parentheses in call to 'pr...
tkj80 General Coding Help 2 11,519 Jan-11-2018, 11:48 PM
    Thread: Subtract Minutes from Datetime.Time
Post: Subtract Minutes from Datetime.Time

Hi, I have a datetime.time object such as: update_Dt.time()Output:datetime.time(21, 30)How do I subtract 5 minutes from the update_Dt.time() object? I tried: update_Dt.time() - timedelta(minutes=15...
tkj80 General Coding Help 2 43,065 May-09-2017, 10:58 PM
    Thread: Convert String to Datetime Object
Post: Convert String to Datetime Object

Hi,  I have the following myList[0][0]Output:'02/28/2017 21:01:00'type(myList[0][0])Output:<class 'str'>str_date = myList[0][0] from datetime import datetime date_date = datetime.strftime(str_...
tkj80 General Coding Help 2 33,826 Apr-20-2017, 03:44 AM
    Thread: List Comprehension to exclude first row
Post: List Comprehension to exclude first row

Hi, I have a list: mylist = [ [header1, header2, header3], [1,2,3], [4,5,6]]how could I use list comprehension to create a list that exclude the first row that contains header? ##without_header = [...
tkj80 General Coding Help 5 4,964 Apr-18-2017, 02:37 AM
    Thread: Writing List to CSV
Post: RE: Writing List to CSV

import csv with open('foo.csv') as csvfile:     reader = csv.reader(csvfile, skipinitialspace=True, delimiter=',')     for row in reader:         if row == []:             pass         else:         ...
tkj80 General Coding Help 6 5,721 Apr-10-2017, 08:19 PM
    Thread: Writing List to CSV
Post: RE: Writing List to CSV

(Apr-05-2017, 10:20 PM)Ofnuts Wrote: What does the file look like in a text editor? Could it be in be just a matter of line endings? When I opened it on a notepad it looks like this: 3-March-17, a,...
tkj80 General Coding Help 6 5,721 Apr-06-2017, 02:35 AM
    Thread: Writing List to CSV
Post: Writing List to CSV

Hi, I have a list as follows stored in a variable name csvImport: [['3-March-17', 'a', 'b', 'c'], ['16-February-17', 'd', 'e', 'f'], ['19-January-17', 'g', 'h', 'i']] I use the following code to wr...
tkj80 General Coding Help 6 5,721 Apr-05-2017, 08:25 PM
    Thread: logging.exception
Post: logging.exception

Hi, I have the following code to log the completion status of my script: import logging try:     logging.basicConfig(filename="C:/Users/AppData/Local/Programs/Python/Python35-32/myScript/log.txt", ...
tkj80 General Coding Help 2 3,305 Feb-24-2017, 12:05 AM
    Thread: calling Class method inside the Class definition
Post: calling Class method inside the Class definition

Hi, I'm writing a class Sunday 1) to get datetime of previous Sunday (method) 2) to return the following attributes:    a) day (in string)    b) month (in string)    c) year (in string) class Sunday...
tkj80 General Coding Help 1 3,727 Jan-23-2017, 04:03 AM
    Thread: Class - Error Message (Indentation)
Post: Class - Error Message (Indentation)

Hi, I have a writing a Class definition. However, I got error msg:  Error:SyntaxError: inconsistent use of tabs and spaces in indentationclass Sunday:                 def __init__(self, dayname, sta...
tkj80 General Coding Help 3 4,500 Jan-20-2017, 03:55 AM
    Thread: changing variable outside of a function
Post: RE: changing variable outside of a function

Hi, thank you everyone for your help and suggestions! I'll try to rework it using Class and see what I'm going to come up with.
tkj80 General Coding Help 8 7,205 Jan-05-2017, 03:52 AM
    Thread: changing variable outside of a function
Post: changing variable outside of a function

Hi, I have the variable sun_Datetime that was initialized globally outside of 2 user defined functions that I have: 1) get_previous_byday(dayname, start_date=None), 2) date_to_str(day, month, year, s...
tkj80 General Coding Help 8 7,205 Jan-04-2017, 11:32 PM
    Thread: Change type of elements in a list by column
Post: RE: Change type of elements in a list by column

(Dec-28-2016, 07:54 PM)micseydel Wrote: Apologies, I tried to reply to this last night but my internet was having issues. Here's something close to what you want newList = [(name, int(num), f(time)...
tkj80 General Coding Help 7 6,846 Jan-04-2017, 11:15 PM
    Thread: Change type of elements in a list by column
Post: RE: Change type of elements in a list by column

I tried the following codes but didn't get the result that I wanted. myList_chg = [int(x[1]) for x in myList] >>>myList_chgOutput:[1, 2, 3]myList_chg_2 = [myList[0], int(x[1]) for x in myLis...
tkj80 General Coding Help 7 6,846 Dec-28-2016, 02:03 AM
    Thread: Change type of elements in a list by column
Post: Change type of elements in a list by column

Hi, say I have the following list: myList = [['john', '1', '2:00pm'], ['becky', '2', '3:15pm'], ['tom', '3', '3:20pm']] the type of every elements in the inner list is string. How do I change (or w...
tkj80 General Coding Help 7 6,846 Dec-28-2016, 12:04 AM
    Thread: Selenium - "Element is not currently visible and may not be manipulated"
Post: Selenium - "Element is not currently visible and m...

Hi, I have been working on the following code to scrape data from the website for my research. However, I got the following error message. "errorMessage":"Element is not currently visible and may not...
tkj80 Web Scraping & Web Development 2 13,876 Oct-26-2016, 11:10 PM
    Thread: BeautifulSoup - Table
Post: RE: BeautifulSoup - Table

(Oct-12-2016, 02:38 AM)metulburr Wrote: Are you sure its not in your source file? Because your OP has BS in it. This is a big difference. Interpreter that you open manually is completely different ...
tkj80 Web Scraping & Web Development 6 9,793 Oct-21-2016, 01:19 AM
    Thread: lambda function
Post: RE: lambda function

Understood. Thank you!
tkj80 General Coding Help 3 5,037 Oct-21-2016, 01:07 AM

User Panel Messages

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