最近很多小伙伴都在问Python声音和“钟声”这两个问题,那么本篇文章就来给大家详细解答一下,同时本文还将给你拓展24/7Python硒“whiletrue:”脚本无法执行driver.get(“UR
最近很多小伙伴都在问Python声音和“钟声”这两个问题,那么本篇文章就来给大家详细解答一下,同时本文还将给你拓展24/7 Python硒“ while true:”脚本无法执行driver.get(“ URL”)、DateTime范围为“长格式”,间隔时间为15分钟(“钟点”) 最终结果、iphone闹钟声音怎么调、iphone: – 用UILocalNotification声音播放录制的声音等相关知识,下面开始了哦!
本文目录一览:- Python声音(“钟声”)(python 声音)
- 24/7 Python硒“ while true:”脚本无法执行driver.get(“ URL”)
- DateTime范围为“长格式”,间隔时间为15分钟(“钟点”) 最终结果
- iphone闹钟声音怎么调
- iphone: – 用UILocalNotification声音播放录制的声音
Python声音(“钟声”)(python 声音)
我想让一个python程序通过发出哔哔声来提醒我。当前,我使用import os
然后使用命令行语音程序说“处理完成”。我宁愿它只是一个简单的“钟”。
我知道有一个可以在 Cocoa 应用程序中使用的功能NSBeep
,但是我认为这与该功能没有任何关系。
我也尝试过
print(\a)
但这没用。
如果您无法从我的 可可粉 评论中得知,我正在使用Mac,这可能会有所帮助。
答案1
小编典典你有没有尝试过 :
import syssys.stdout.write(''\a'')sys.stdout.flush()
在Mac OS 10.5上适合我
实际上,我认为您的原始尝试也可以进行一些修改:
print(''\a'')
(您只需要在字符序列周围加上单引号即可)。
24/7 Python硒“ while true:”脚本无法执行driver.get(“ URL”)
您可以仅使用Python或“ curl ”命令来代替Selenium来实现。
Read here how to login to instagram using its exposed API for developers
通过这种方式,您可以创建bash / shell脚本来在需要时触发脚本,而无需保持IDE的运行。
DateTime范围为“长格式”,间隔时间为15分钟(“钟点”) 最终结果
我想出了自己的解决方案,
# Split into quarters
new = pd.DataFrame(((
e.name,e.flag,# for the first interval use the starttime
e.starttime if date == e.starttime.floor('15min') else date,# for the last interval use the endtime
e.endtime if date == e.endtime.floor('15min') else date + pd.Timedelta(minutes=15)
)
#iterate over thet uples
for e in df.itertuples()
# iterate for each range date
for date in pd.date_range(e.starttime.floor('15min'),e.endtime.floor('15min'),freq='15min')
),columns = ['name','flag','start','end'])
# calculate the duration
new['duration'] = new['end']- new['start']
但是,它并不完美,我需要在可能导致错误的过程中修复很多细节。这似乎是一个典型的用例,所以我相信那里应该有更好的解决方案。
最终结果
我的最终数据集看起来像这样。我可以重用其中的一些专栏,但我认为这种方法很明显可以反映出为解决该问题而采取的步骤。
name flag start end duration
0 Alice y 2020-03-20 15:05:00 2020-03-20 15:15:00 00:10:00
1 Alice y 2020-03-20 15:15:00 2020-03-20 15:30:00 00:15:00
2 Alice y 2020-03-20 15:30:00 2020-03-20 15:41:00 00:11:00
3 Bob m 2020-03-20 15:16:00 2020-03-20 15:30:00 00:14:00
4 Bob m 2020-03-20 15:30:00 2020-03-20 15:40:00 00:10:00
5 Chap y 2019-03-20 12:58:00 2019-03-20 13:00:00 00:02:00
6 Chap y 2019-03-20 13:00:00 2019-03-20 13:15:00 00:15:00
7 Chap y 2019-03-20 13:15:00 2019-03-20 13:30:00 00:15:00
8 Chap y 2019-03-20 13:30:00 2019-03-20 13:41:00 00:11:00
9 Dana y 2020-03-20 20:05:00 2020-03-20 20:15:00 00:10:00
10 Dana y 2020-03-20 20:15:00 2020-03-20 20:30:00 00:15:00
11 Dana y 2020-03-20 20:30:00 2020-03-20 20:44:00 00:14:00
iphone闹钟声音怎么调
调整 iphone 闹钟声音的方法如下:打开“时钟”应用。选择闹钟并点击“声音”。从铃声列表中选择您喜欢的铃声。预览声音并点击“后退”或“完成”保存更改。
如何调整 iPhone 闹钟声音
调节 iPhone 闹钟声音非常简单,只需以下几个步骤:
步骤 1:打开“时钟”应用
- 点击主屏幕上的“时钟”应用图标。
步骤 2:选择闹钟
- 点击要修改声音的闹钟。
步骤 3:点击“声音”
- 在闹钟设置菜单中,找到“声音”选项,然后点击它。
步骤 4:选择声音
- 您将看到一个可供选择的铃声列表。滚动浏览列表并点击您喜欢的铃声。
步骤 5:预览声音
- 点击铃声名称旁边的播放图标可预览声音。
步骤 6:保存更改
- 选择声音后,点击“后退”按钮或闹钟设置菜单顶部的“完成”按钮以保存更改。
小贴士:
- 您还可以通过“设置”>“声音和触感”>“铃声”来更改设备上的所有铃声。
- 除了内置铃声外,您还可以使用自己设备上的音乐或声音作为闹钟声。
- 闹钟声音会在您设置手机为静音或振动时自动静音。
以上就是
iphone: – 用UILocalNotification声音播放录制的声音
录音代码: –
-(IBAction)startRecording { AVAudioSession *audioSession = [AVAudioSession sharedInstance]; NSError *err = nil; [audioSession setCategory :AVAudioSessionCategoryPlayAndRecord error:&err]; NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES); Nsstring *documentPath = [searchPaths objectAtIndex:0]; NSLog(@"ccc...%@",documentPath); if(toggle) { toggle = NO; recordSetting = [[NSMutableDictionary alloc] init]; [recordSetting setValue:[NSNumber numberWithInt: 1] forKey:AVNumberOfChannelsKey]; strRecordedVoice=[Nsstring stringWithFormat: @"%.0f.%@",[NSDate timeIntervalSinceReferenceDate] * 1000.0,@"caf"]; recordedTmpFile = [NSURL fileURLWithPath:[documentPath stringByAppendingPathComponent:strRecordedVoice]]; NSLog(@"Using Filepath called: %@",recordedTmpFile); NSLog(@"Using str: %@",strRecordedVoice); recorder = [[ AVAudioRecorder alloc] initWithURL:recordedTmpFile settings:recordSetting error:&error]; [recorder setDelegate:self]; [recorder preparetoRecord]; [recorder record]; progressView.progress = 0.0; [recorder recordForDuration:(NSTimeInterval) 2]; lblStatusMsg.text = @"Recording..."; progressView.progress = 0.0; timer = [NSTimer scheduledTimerWithTimeInterval:0.2 target:self selector:@selector(handleTimer) userInfo:nil repeats:YES]; } else { toggle = YES; //Stop the recorder. [recorder stop]; } }
//用于本地通知的代码
-(void) schedulelocalnotificationWithDate:(NSDate *)fireDate { UIlocalnotification *notification =[[UIlocalnotification alloc]init]; notification.fireDate=fireDate; notification.repeatInterval = 0; notification.alertAction = NSLocalizedString(@"View",@"View"); notification.soundName = UIlocalnotificationDefaultSoundName; NSDictionary *userDict = [NSDictionary dictionaryWithObject:ap.strAlarmTitle forKey:kRemindMeNotificationDataKey]; notification.userInfo = userDict; [[UIApplication sharedApplication] schedulelocalnotification:notification]; [notification release]; } Reference:-you can see it its an alarm application which uses uilocalnotification itunes.apple.com/us/app/record-alarm-free/id418511936?mt=8
解决方法
source
关于Python声音和“钟声”的问题我们已经讲解完毕,感谢您的阅读,如果还想了解更多关于24/7 Python硒“ while true:”脚本无法执行driver.get(“ URL”)、DateTime范围为“长格式”,间隔时间为15分钟(“钟点”) 最终结果、iphone闹钟声音怎么调、iphone: – 用UILocalNotification声音播放录制的声音等相关内容,可以在本站寻找。
本文标签: