STAY WITH US

[Hindi]NLP 04# Working with Text File P-1 |NLP|Python 3|Natural Language Processing|2019

[Hindi]NLP 04# Working with Text File P-1 |NLP|Python 3|Natural Language Processing|2019


Code:

# -*- coding: utf-8 -*-
"""NLP_Ex3.ipynb

Automatically generated by Colaboratory.

"""

# Commented out IPython magic to ensure Python compatibility.
# %%writefile sample.txt
# Hello, My name is Vishwajeet S Rana
# I am a YouTuber,
# My YouTube channel name is Knowledge Shelf

file = open('sample.txt')

pwd

file

file.read()

file.read()

file.seek(0)

file.read()

file.seek(0)

var1 = file.read()
print(var1)

file.close()

file = open('sample.txt')

file.readlines()

file.seek(0)

lines = file.readlines()

lines

for line in lines:
  print(line.split()[0])

YouTube:



Recommended Book:


Click Me

Post a Comment

0 Comments