هل تسألت هل يمكن نسخ أو لصق نص أو كلمه تلقائيا بدون تحديد النص والضغط علي زر نسخ؟
w
يمكنك فعل ذلك بواسطه مكتبه في لغه البرمجه Python تستطيع نسخ ولصق الكلمات التي تريدها تلقائيا بواسطه مكتبه في بايثون يطلق عليها: PyperClip وهي لتخزين البيانات ولها إستخدامات عديده لاكن سنستخدم النسخ واللصق
كيفيه تثبيت المكتبه ؟
1- قم بفتح سطر الأوامر
2- pip install pyperclip
بعد تثبيت المكتبه قم بإنشاء ملف بايثون جديد.
ماذا يفعل كل سطر ؟
1- السطر الأول لإستدعاء المكتبه pyperclip
2- السطر الثاني لإستدعاء مكتبه time لعمل وقت إنتظار
3- السطر الثالث لوضع متغير به الكلمه المراد نسخها
4- السطر الرابع لنسخ المتغير yehia الذي يتواجد فيه الكلمه
5- السطر الخامس لطباعه كلمه انتظر جاري اللصق
6- السطر السادس لإجراء وقت إنتظار 5 ثواني
7- السطر السابع لإعطاء متغير للصق
8- السطر الثامن لعمل طباعه للمتغير وإظهار ما تم نسخه
8- السطر الثامن لعمل طباعه للمتغير وإظهار ما تم نسخه
يمكنك حذف سطر 6,7,8,9 إذا كنت لا تريد اللصق وتريد النسخ فقط.
# we will insert the list first and make the N for the length of the list and another list we will fill it with -1 value and the same length as the first length
ReplyDelete# and we will make stack than we will make a loop that make sure it will loop the list only one cycle than make if statment if the stack is empty
# and another if statement if the list index moudle the length of the list is greater thean the list index of the stack empty
# and insert to the seacond list the key of the stack and remove elment frome stack, else insert the elment to stack and change the variable that loop to +1
# else of the first loop insert to the stack the reminder of the variable with the length of the list and change the variable that loop to +1
# last print the second list
# insert the list
lista = [177, 175, 166, 184, 186, 179, 170,187,167]
# make a variable with the length of the list
N=len(lista)
#make another list with same length of the first list and fill it with -1 value
theoutput = [-1 for _ in range(N)]
# make a stack
stacka=[]
# make a variable for the loop
G=0
while(G!=2*N):
# If the stack is not empty
if(len(stacka)!=0):
# the element is greater
# than top element of the stack
if(lista[G % N] > lista[stacka[-1]]):
# check next greater element
# for the top element of the stack
theoutput[stacka[-1]]=lista[G%N]-lista[stacka[-1]]
stacka.pop() #remove element from the top of the stack
else:
stacka.append(G % N) #puch element in stack
G+=1 #increase the variable with 1
else:
stacka.append(G % N) # push element in stack
G+=1 #increase the variable with 1
print(theoutput) #print the seacnd list