Assignment if statement

This is the place for queries that don't fit in any of the other categories.

Assignment if statement

Postby PythonLearner » Thu Sep 29, 2016 3:53 pm

Hi,

I'm new to Python and to this forum so please pardon if this may be doltish question.
Code: Select all
    Order_Date = xlrd.xldate.xldate_as_datetime(sheet.cell(r,1).value,book.datemode)
    if Order_Date == '':
        ''
    else:
        Order_Date

I have blanks in my Excel sheet (my data source) under the date field and Python is throwing out an error saying
Code: Select all
"""""ValueError: invalid literal for int() with base 10:"""" ''
I'm trying to tell Python that if it sees a ' ' blank in Excel return blank and it sees a date value return a date value.

Any assistance provided would be greatly appreciated.
Last edited by Yoriz on Thu Sep 29, 2016 4:30 pm, edited 1 time in total.
Reason: First post lock. Added code tags.
PythonLearner
 
Posts: 1
Joined: Thu Sep 29, 2016 3:49 pm

Return to General Coding Help

Who is online

Users browsing this forum: No registered users and 3 guests