Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8426131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:27:50+00:00 2026-06-10T04:27:50+00:00

I select some urls from my database using a simple code def crearArchivo(self): #Se

  • 0

I select some urls from my database using a simple code

def crearArchivo(self):
        #Se conecta a la base de datos
        db = MySQLdb.connect("localhost","root","","proyectoacademias" )

        cursor = db.cursor()

        #Selecciona la lista de valores que no hayan sido procesados
        sql = "SELECT url_paper_web FROM acw_papers_web WHERE finalizado = 0"

        cursor.execute(sql)

        #Recibe todos los datos
        datos = cursor.fetchall()

        #Crea el archivo
        archivo = open('urls.txt','w')
        archivo.close()

        #Lo abre
        archivo = open('urls.txt','w')

        #Establece un contador para determinar el numero de filas
        contador=0;

        #Para cada fila la guarda en el archivo y si no es la ultima agrega un salto de linea
        for columna in datos:

            contador+=1;

            archivo.write(str(columna))

            if(contador!=len(datos)):
                archivo.write("\n") 


        #Se cierra todo
        archivo.close()
        db.close()

This method places those links in a file… the problem is that those links instead of being saved like http:// google.com they are saved like (‘http://google.com’)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T04:27:51+00:00Added an answer on June 10, 2026 at 4:27 am

    Each columna variable is actualy a row, not a single column. Simply select the first value in that row:

    archivo.write(columna[0])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have the following code that generate some images with urls associated from database:
I need to select some values from a json response. Im using json.net, fine
I have the query to select some columns from two tables, which must contain
I'm tying to select images based on their URLs, but for some reason it's
I'm being told that I shouldn't be using database IDs directly in HTML code
My current query (doesn't work) SELECT url FROM table WHERE 'http://www.longurl.com/some/string' like '%' .
I want to select some data from the sqllite Db. Now I face a
I'm parsing some information using Xpath and it returns me a simple array. $values
How can I select some parts of an matrix and cut the single dimensions?
I'm trying to select some integer values in MySQL. Several of the values are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.