Python Forum
unable to print the list when using re.findall()
Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
unable to print the list when using re.findall()
#1
code:
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 20 07:44:11 2017

@author: Srinu
"""
import re
f=open('D:\EDUCATION\python\google-python-exercises\\babynames\\baby2008.html','r')
tuples=re.findall(r'<td>(\d+)</td><td>(\w+)</td><td>(\w+)</td>','f.read()')
print(tuples)

error:

runfile('D:/EDUCATION/python/my progs/strs.py', wdir='D:/EDUCATION/python/my progs')
[]

printing empty list as above


Messages In This Thread
unable to print the list when using re.findall() - by satyaneel - Sep-27-2017, 09:55 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  unable to remove all elements from list based on a condition sg_python 3 478 Jan-27-2024, 04:03 PM
Last Post: deanhystad
Question mypy unable to analyse types of tuple elements in a list comprehension tomciodev 1 507 Oct-17-2023, 09:46 AM
Last Post: tomciodev
  regex findall() returning weird result Radical 1 673 Oct-15-2023, 08:47 PM
Last Post: snippsat
  How do you get Python to print just one value in a list? 357mag 3 1,040 May-17-2023, 09:52 PM
Last Post: rob101
  Python: re.findall to find multiple instances don't work but search worked Secret 1 1,238 Aug-30-2022, 08:40 PM
Last Post: deanhystad
  Print List to Terminal DaveG 2 1,458 Apr-02-2022, 11:25 AM
Last Post: perfringo
  Unable to use random.choice(list) in async method spacedog 4 3,484 Apr-29-2021, 04:08 PM
Last Post: spacedog
  Print max numbers in a list jimmoriarty 1 2,176 Sep-25-2020, 07:29 AM
Last Post: DPaul
  regex.findall that won't match anything xiaobai97 1 2,051 Sep-24-2020, 02:02 PM
Last Post: DeaD_EyE
  Unable to print stuff from while loop Nick1507 4 2,381 Sep-17-2020, 02:26 PM
Last Post: Nick1507

Forum Jump:

User Panel Messages

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