Python Forum
How to jump to a specific row when getting data in ms Access using python?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to jump to a specific row when getting data in ms Access using python?
#1
The code that I get from the net will go through a loop to get all the data of ms Access.

def access(): l =[] conn = pyodbc.connect(r'Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:\Users\GOBOTIX\Desktop\Try.mdb;') cursor = conn.cursor() cursor.execute('select * from Try')

for row in cursor.fetchall(): l.append(row)

dates = [i[1] for i in l] freq1 = [i[2] for i in l] freq1 = list(map(int, freq1))

conn.close()

return dates, freq1
I just want to start at a certain row to lessen the time of saving the data to excel.
Reply
#2
To always know what you're working with, examine the data before writing any code.
in this instance, a simple print statement will tell you a lot.
def access():
    l =[] conn = pyodbc.connect(r'Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:\Users\GOBOTIX\Desktop\Try.mdb;')
	cursor = conn.cursor()
	cursor.execute('select * from Try')
 
for row in cursor.fetchall():
    print(row)
    ...
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  data validation with specific regular expression shaheen07 0 337 Jan-12-2024, 07:56 AM
Last Post: shaheen07
  How to Connect to PostgreSQL Through Jump Server and SSH Tunnel using Python? nishans 1 982 Jan-02-2024, 10:37 AM
Last Post: khanzain
  data file for .exe program to access ose 2 1,180 Nov-23-2022, 08:02 PM
Last Post: snippsat
  How to extract specific data from .SRC (note pad file) Shinny_Shin 2 1,268 Jul-27-2022, 12:31 PM
Last Post: Larz60+
  How do I make him jump once izmamonke 1 1,576 Jul-22-2021, 08:35 PM
Last Post: bowlofred
  Extracting data based on specific patterns in a text file K11 1 2,211 Aug-28-2020, 09:00 AM
Last Post: Gribouillis
  Can't access the net using Python's Selenium module ShishirModi 2 2,056 Jul-21-2020, 06:03 AM
Last Post: ShishirModi
  Process Data from one csv file and write to another CSV file specific column ajin9581 1 1,993 Jun-17-2020, 06:00 PM
Last Post: buran
  Python for MS Access DB Kundan 0 1,872 Feb-20-2020, 08:27 AM
Last Post: Kundan
  How to access specific values from a dict? t4keheart 6 3,104 Feb-05-2020, 11:34 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

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