-3

I'm new to python and this forum. I am currently using PyCharm, and using it to make a simple code that prints the source code of website on the screen. I saw a video and the code was something like:

import requests

from bs4 import BeautifulSoup4

url = "Google.com"
S = requests.get(url)
C = s.text
T = BeautifulSoup(C)

print(T)

Now I want to read a line in the source code from a website, like a fixed definite line, how am I supposed to do it?

Also, how to use pyttsx on Windows in PyCharm. I need a text to speech engine for python.

Is there any way I can use a speech recognition engine on python. I mean online like Google or offline too?

Sean Francis N. Ballais
  • 2,338
  • 2
  • 24
  • 42
Harsh8V
  • 31
  • 4

1 Answers1

0

I got it to work . It was I guess , a bug ... I did this at the end

import requests
len=20 #length of string u want to copy
Url="some random url"
T1=requests.get(Url)
T2=T1.content
Pos=T2.find("Search string")
String=T2[pos:pos+len]
print(String)

In my original project the string length was not definite , but I got it to work , by using while loop to copy the string until an ending remarks like <p> appear. That worked out too .

I used VBScript for the Speech Synthesis And used Google speech recognition .

Kara
  • 6,115
  • 16
  • 50
  • 57
Harsh8V
  • 31
  • 4