How to get copied text from clipboard in Python

You can get copied text from clipboard in Python with the following code. I highly recommend you This book to learn Python.

Read copied text

# Import the Pandas library as pd
import pandas as pd

# Get copied text in Python
data = pd.read_clipboard(sep=',')

# Display the copied data
print(data)

Output:

   Area  Rooms  House_Age  Price
0  5000      5          5  75000
1  4000      4          5  65000
2  3000      3          1  60000
3  2000      3          1  58000
4  1500      2          1  50000
5  7000      5          5  90000
6  6000      5          3  85000
7  6500      4          7  80000
8  8000      5         15  95000

Free Learning Resources

Leave a Comment

Your email address will not be published.