鱼C论坛

 找回密码
 立即注册
查看: 888|回复: 1

我获取了弹窗的值 我现在想把这个值变成 '值' 可我不知道怎么添加''

[复制链接]
发表于 2021-7-21 10:04:45 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
from tkinter import *
import requests,os
from bs4 import BeautifulSoup
q=None
root = Tk()

Label(root, text="请输入网址:").grid(row=0, column=0)  # 第0行第0列


v1 = StringVar()

e1 = Entry(root, textvariable=v1)

e1.grid(row=0, column=1, padx=10, pady=5)


def show():
    #print( e1.get())
    q=e1.get()
   
    return
   
Button(root, text="Enter", width=10, command=show)\
    .grid(row=3, column=0, sticky=W, padx=10, pady=5)  # W左边


Button(root, text="退出", width=10, command=root.quit)\
    .grid(row=3, column=1, sticky=E, padx=10, pady=5)  # E右边


mainloop()
------------------------------------------------------------------------------------------
我想把获取的弹窗值变成    ' 值 '   在值的首位添加两个单引号
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2021-7-22 13:53:18 | 显示全部楼层
不是很理解你的意思。。。
你的意思是给e1.get()返回的值包上单引号?
那直接
q = "'" + e1.get() + "'"
不就好了吗?
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-10-8 20:32

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表