All New

user:thomas gists created by user

title:mygist gists with given title

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

topic:homelab gists with given topic

Login


All New Login

All gists matching topic text-processing

Recently created
Least recently created
Recently updated
Least recently updated

timmy / 使用 re 進行正規表示式匹配

0 likes
0 forks
1 files
Last active 9 months ago
re 模組提供強大的正規表示式功能,可用於文字搜尋、字串處理與資料驗證,適用於日誌分析、表單驗證與文字解析等場景。
pattern-matching python re regex text-processing validation
1 import re
2
3 # 定義正規表示式模式
4 pattern = r"\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b"
5
6 # 測試字串
7 text = "聯絡我們: support@example.com 或 visit@example.org"
8
9 # 搜尋第一個匹配的電子郵件
10 match = re.search(pattern, text)

timmy / 使用 Streamlit 建立文件內容查看器

0 likes
0 forks
1 files
Last active 10 months ago
此程式使用 Streamlit 讓使用者上傳文字或 Markdown 檔案,顯示其內容,並透過暫存檔處理,可應用於文件檢視與內容處理工具。
automation file-upload markdown python streamlit text-processing ui
1 import streamlit as st
2 import os
3
4 # 標題
5 st.title("文件內容查看器")
6
7 # 文件上傳
8 uploaded_file = st.file_uploader("請上傳文字或 Markdown 文件", type=["txt", "md"])
9
10 # 如果有文件被上傳
Newer Older

Powered by Opengist ⋅ Load: 30ms⋅

English
Čeština Deutsch English Español Français Magyar Italiano 日本語 Polski Português Русский Türkçe Українська 中文 繁體中文